package java_test.nettest;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class InetAddressTest {
    public static void main(String[] args) {
        var a = 10;
        InetAddress inetAddress;
        try {
            inetAddress = InetAddress.getByName("www.baidu.com");
            System.out.println(inetAddress);
            System.out.println(InetAddress.getLocalHost());
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }
}
